﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Oca35.Tests
{
    [TestClass]
    public class PitSquareFixture
    {
        [TestMethod]
        public void PlayerWaitAnotherPlayerToPassIt()
        {
            var board = new Board();
            var player = new Player();
            var player2 = new Player();
            board.Players = new Player[]  { player, player2 };
            
            var pitsquare = board.Squares[30];
            player.Location = pitsquare;
            player2.Location = board.Squares[25];

            pitsquare.ApplyActions(player);
            Assert.AreNotEqual(board.Squares[30], player2.Location);
            Assert.IsFalse(pitsquare.CanPlay(player));

            player2.Location = board.Squares[35];
            Assert.IsTrue(pitsquare.CanPlay(player));
            //Assert.AreEqual(board.Squares[25], player2.Location);
        }

        [TestMethod]
        public void OnePlayerCanPlayTheOtherReplaceIt()
        {
            var board = new Board();
            var player = new Player();
            var player2 = new Player();
            var player3 = new Player();
            board.Players = new Player[] { player, player2,player3 };

            var pitsquare = board.Squares[30];
            player.Location = pitsquare;
            player2.Location = board.Squares[25];
            player3.Location = board.Squares[18];

            pitsquare.ApplyActions(player);
            Assert.IsFalse(pitsquare.CanPlay(player));
            player2.Location=board.Squares[30];
            pitsquare.ApplyActions(player2);
            Assert.IsTrue(pitsquare.CanPlay(player));
            Assert.IsFalse(pitsquare.CanPlay(player2));
        }
    }
}
